﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using OptusMobile.Web.ServerComponents.DAL;
using OptusMobile.Web.ServerComponents.Common;


namespace OptusMobile.Web.ServerComponents.BAL.Authentication
{
    /// <summary>
    /// Provides APIs for Authentication.
    /// </summary>
    public class LoginManager : EFManagerBase
    {
        public List<User> GetAllUsers()
        {
            try
            {
                return this.ObjectContext.UserSet.ToList();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public bool UserAuthenticate(string userName, string password)
        {
            try
            {
                return this.ObjectContext.UserLogin(userName, password);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public bool AdminAuthenticate(string userName, string password)
        {
            try
            {
                return this.ObjectContext.AdminLogin(userName, password);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

    }
}
